<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/course_php.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
	$con = @mysql_connect('localhost', 'root', '');
	if (!$con) {
		die("Đã xảy ra lỗi trong quá trình xử lý." . mysql_error());
	}
	
	$db_selected = @mysql_select_db('studial');
	if (!$db_selected) {
		die("Đã xảy ra lỗi trong quá trình xử lý." . mysql_error());
	}
?>
<title><?php ?></title>
<link rel="stylesheet" type="text/css" href="../css/global.css" />
<link rel="stylesheet" type="text/css" href="../css/loggedpages.css" />
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
	#gradetable {
		width: 720px;
		margin: 2em auto 2em auto;
		border: 1pt solid #d0d0d0;
		border-collapse: collapse;
	}
	
	#gradetable th, #gradetable td {
		border: 1pt solid #d0d0d0;
		text-align: center;
		padding: 3px;
		font-size: 14px;
	}
	
	.order, .grade { width: 50px; }
	
	.event { width: 300px; }
	
	.filename, .time { width: 160px; }
</style>
<!-- InstanceEndEditable -->
</head>

<body>
	<div class="header">
        <div class="innercontent">
            <img alt="Studial" class="logo" src="../images/logo.jpg" />   
            <form id="searchform" method="post" action="">
                <div id="searchblock">
                    <input id="searchfield" name="searchfield" type="text" placeholder="Tìm kiếm" />
                    <button id="searchbutton" type="submit" name="search" value="1" title="Tìm kiếm" onclick="window.location = '../unlogged/index.php'"><img id="searchicon" src="../images/searchicon.png" /></button>
                </div>           
            </form>
            <div id="rightheader">
                <a class="headerbutton" id="logout"><span id="borderleft"></span>Đăng xuất</a>
                <a class="headerbutton" id="toboard"><?php echo "Username" ?></a>
            </div>
        </div>
    </div>
    <div class="innercontent">
        <div id="leftcolumn">
            <img alt="Avatar" id="largeavatar" src="<?php echo $path = "../images/male_avatar.png"; ?>" />
        	<div id="sidenavcontainer">	
                <ul id="sidenav">
            		<li><a class="navlink" href=""><span id="boardnav">Bảng</span></a></li>
                    <li><a class="navlink" href=""><span id="eventnav">Sự kiện</span></a></li>
                    <li><a class="navlink" href=""><span id="membernav">Thành viên</span></a></li>
                    <?php if (1) echo "<li><a class=\"navlink\" href=\"\"><span id=\"gradenav\">Bảng điểm</span></a></li>"; ?>
            	</ul>
            </div>
        </div>
        <div id="contentcolumn">
        	<div id="contentcolheader">
            	<h2>Coursename</h2>
                <div id="description">Description</div>
            </div>
		<!-- InstanceBeginEditable name="maincontent" -->
			<table id="gradetable">
            	<thead>
                	<tr>
                    	<th class="order">STT</th>
                        <th class="event">Sự kiện</th>
                        <th class="filename">Tên tệp tin</th>
                        <th class="time">Thời gian nộp</th>
                        <th class="grade">Điểm</th>
                    </tr>
                </thead>
                <tbody>
                <?php
					function returndatetime($id)
					{
						$date = new DateTime($id);
						return $date->format('d/m/Y');			
					}
				
					//-----------------------------------------------------
					
					
					$course_id = $_GET['id'];
					$user_id = $_COOKIE['studialuserid'];
					
					
					
					//Tim tat ca cac bai nop cua user
					$result = mysql_query("select `assignments`.`name`, `assignment_submission`.`path`, `assignment_submission`.`datesubmitted`, `assignment_submission`.`grade` from `assignment_submission` inner join `assignments` on `assignment_submission`.`assignment_id` = `assignments`.`id` where `assignment_submission`.`user_id` = '".$user_id."' and `assignments`.`course_id` = '".$course_id."';");
					
					$rows_num = mysql_num_rows($result);
					
					for( $i = 0 ; $i < $rows_num ; $i ++)
					{
						$rows = mysql_fetch_array($result);
						echo '<tr>';
						echo '<td class="order">'.($i+1).'</td>';
						echo '<td class="event"><a href="">'.$rows['name'].'</a></td>';
						echo '<td class="filename">'.$rows['path'].'</td>';
						echo '<td class="time">'.returndatetime($rows['datesubmitted']).'</td>';
						echo '<td class="grade">'.$rows['grade'].'</td>';
						echo '</tr>';
					}
				
				?>
                
                </tbody>
            </table>
		<!-- InstanceEndEditable -->
    	</div>
    </div>
    <div class="footer">
    	<div id="leftfooter">Studial @ 2012 - Nhóm 01</div>
        <div id="rightfooter">
			<a href="" title="Đăng ký thêm tên trường vào hệ thống">Đăng ký trường</a>
            -
            <a href="" title="Đăng ký thêm tên ngành học vào hệ thống">Đăng ký ngành</a>
        </div>
    </div>       
</body>
<!-- InstanceEnd --></html>
